<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<!DOCTYPE html>
<html lang="zh-CN">
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <%@ include file="/WEB-INF/views/include/head.jsp"%> 
        <link rel="stylesheet" href="${ctxStatic}/css/common_erp.css">
		<link rel="stylesheet" href="${ctxStatic}/css/list.css">
        <script>
            $(document).ready(function(){
            	searchListForm();
       	    });
                //重置
               function clearParam(){
                   $("#searchForm")[0].reset();  
                    $('#styleCategoryCd').val('');
                    $("#styleCategoryCd").select2(); 
                    $('#styleFitCd').val('');
                    $("#styleFitCd").select2(); 
                    $('#styleSizeGroupCd').val('');
                    $("#styleSizeGroupCd").select2(); 
                    $('#styleSizeCd').val('');
                    $("#styleSizeCd").select2(); 
                    $("#searchForm").submit();
                    searchListForm();
               }
                
               // 检索方法
           	function searchListForm() {
           		var params = $("#searchForm").serialize();
           		$("#activity_pane").showLoading();
           		$.post("${ctx}/fabric/consumption/searchList",params,function(result) {
           					var listHtml = result["consumption"];
           					var pageHtml = result["page"];
           					$("#listHtml").html(listHtml);
           					$("#paging").html(pageHtml);
           					$("#activity_pane").hideLoading();
           				}, 'json');
           	}
            
                //尺码组联动
                function subStyleSize(t,id){
                    var code=$(t).find("option:selected").attr("data-value");
                    var param={"code":code};
                    $.post("${ctx}/fabric/consumption/styleSize",param,function(result){
                        var html="<option value=''><spring:message code='size_pleaseChoosed'/></option>";
                        $.each(result,function(i,e){
                            html+="<option value='"+e.itemCode+"-"+e.itemValue+"'>"+e.itemName+"</option>";
                        });
                        $("#"+id).html(html);
                        $("#"+id).select2();
                    },'json');
                }
        </script>
    </head>
    <body>
        <form  style="width: 1305px;height: 800px" id="searchForm" method="post">
        <c:set value="<%=ResourcesUtil.getConfig(\"size_styleCategory\")%>" var="styleCategory" />
        <c:set value="<%=ResourcesUtil.getConfig(\"size_styleFitCd\")%>" var="styleFit" />
        <c:set value="<%=ResourcesUtil.getConfig(\"size_styleSizeGroupCd\")%>" var="sizeGroup" />
        <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
        <input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
        <div class="listArea" id="activity_pane">
          <div class="listBg">
         	<div class="searchArea clearfix">
         		<div class="searchLeft clearfix">
                    <div class="searchInp clearfix">
                        <!-- 款式类别 -->
                        <p><spring:message code="size_styleCategory"/></p>                        
                            <select style="width:125px" id="styleCategoryCd" name="styleCategoryCd"  >
                             <option value=""><spring:message code="myWarehouse_pleaseChoosed"/></option>
                              <c:forEach items="${fns:getDictList(styleCategory)}"   var="category">
                                 <option  <c:if test="${fn:split(consumption.styleCategoryCd,'-')[1] eq category.itemValue}">selected="selected"</c:if> value="${category.itemCode}-${category.itemValue}" > 
                                     ${category.itemName}
                                 </option>
                             </c:forEach>
                         </select>                       
                    </div>
                    <div class="searchInp clearfix">
                        <!-- 版型 -->
                        <p><spring:message code="size_styleFit"/></p>
                            <select style="width:125px" id="styleFitCd" name="fitCd"  >
                                 <option value=""><spring:message code="myWarehouse_pleaseChoosed"/></option>
                                  <c:forEach items="${fns:getDictList(styleFit)}"   var="fit">
                                     <option  <c:if test="${fn:split(consumption.fitCd,'-')[1] eq fit.itemValue}">selected="selected"</c:if> value="${fit.itemCode}-${fit.itemValue}" > 
                                         ${fit.itemName}
                                     </option>
                                 </c:forEach>
                             </select>                       
                    </div>
                    <div class="searchInp clearfix">
                        <!-- 尺码组 -->
                        <p><spring:message code="size_sizeGroup"/></p>
                            <select style="width:125px" id="styleSizeGroupCd" name="styleSizeGroupCd" onchange="subStyleSize(this,'styleSizeCd')" data-rule-required="true" data-msg-required="<spring:message code="fitproperty_pleaseChoosedUnit"/>" >
                             <option value=""><spring:message code="size_pleaseChoosed"/></option>
                              <c:forEach items="${fns:getDictList(sizeGroup)}"   var="group">
                                 <option data-value="${group.itemValue}" <c:if test="${fn:split(consumption.styleSizeGroupCd,'-')[1] eq group.itemValue}">selected="selected"</c:if> value="${group.itemCode}-${group.itemValue}" > 
                                     ${group.itemName}
                                 </option>
                             </c:forEach>
                         </select>
                        </div>
                        <div class="searchInp clearfix">
                        <!-- 尺码 -->
                        <p><spring:message code="size_size"/></p>
                            <select style="width:100px"  id="styleSizeCd" name="styleSizeCd" >
                            <option value=""><spring:message code="size_pleaseChoosed"/></option>
                            <c:forEach items="${fns:getDictList(fn:split('', '-')[1])}" var="styleSize">
                                <option 
                                      value="${styleSize.itemCode}-${styleSize.itemValue}">
                                    ${styleSize.itemName}
                                </option>
                            </c:forEach>
                        </select>
                        </div>
                </div>
                <div class="searchRight clearfix">
                	<!-- 检索 -->
                    <button type="button" class="btn-js" onclick="searchListForm();"><spring:message code="commom_check"/></button>      
                    <!-- 重置 -->
                    <button type="button" class="btn-js" onclick="clearParam();"><spring:message code="common_reset"/></button>
                    <!-- 创建 -->
                    <button type="button" class="btn-cj" onclick="popup('800px','600px','${ctx}/fabric/consumption/form')"><spring:message code="common_create"/></button>
                </div>
            </div>
            <div class="tableArea">
				<div class="" style="overflow: auto;width: 1293px;padding-top: 36px;height: 714px; ">
                <table cellpadding="0" class="tableHead" >
                    <thead>
                    <tr>
                        <!-- 序号No. -->
                        <th><p class="table-No" ><spring:message code="common_no"/></p></th>
                        <!-- 款式类别 -->
                        <th><p class="table-con-kslb" ><spring:message code="size_styleCategory"/></p></th>
                       <!-- 版型 -->
                        <th><p class="table-con-bx" ><spring:message code="size_styleFit"/></p></th>
                        <!-- 尺码组 -->
                        <th><p class="table-con-cmz" ><spring:message code="size_sizeGroup"/></p></th>
                        <!-- 尺码 -->
                        <th><p class="table-con-cm" ><spring:message code="size_size"/></p></th>
                        <!-- 单耗 -->
                        <th><p class="table-con-dh" ><spring:message code="size_Cost"/></p></th>
                        <!-- 状态 -->
                        <th><p class="table-con-zt" ><spring:message code="size_state"/></p></th>
                        <!-- 创建人 -->
                        <th><p class="table-con-gxr" ><spring:message code="size_update_user"/></p></th>
                        <!-- 创建日期 -->
                        <th><p class="table-con-gxrq" ><spring:message code="size_update"/></p></th>
                     </tr>
</thead>
</table>
<table cellpadding="0" class="tableBody">
<tbody  id = "listHtml"></tbody>
</table>
</div>
</div>
</div>
<div id = "paging" ></div>
</div>
</form stys>
</body>
</html>